<template>
    <div>
        <el-table
        :data="ordersTable"
        style="width: 100%">
            <el-table-column
            label="商品详情"
            width="120">
            <template slot-scope="scope">
                <div slot="reference" class="name-wrapper">
                    <router-link :to="'/detail?category='+scope.row.category+'&id='+scope.row.product_id" style="color:black">
                        <img :src="require('@/assets/'+scope.row.category+'/'+scope.row.product_id+'/1.jpg')" style="width: 100px; height: 100px"><br>
                    </router-link>
                </div>
            </template>
            </el-table-column>
            <el-table-column
                prop="id"
                label="ID"
                width="70">
            </el-table-column>
            <el-table-column
                prop="username"
                label="购买人"
                width="100">
            </el-table-column>
            <el-table-column
                prop="shopname"
                label="商品所属店铺"
                width="150">
            </el-table-column>
            <el-table-column
                prop="title"
                label="商品标题"
                width="270">
            </el-table-column>
            <el-table-column
                prop="product_nums"
                label="购买数量"
                width="60">
            </el-table-column>
            <el-table-column
                prop="outtradeno"
                label="订单号"
                width="290">
            </el-table-column>
            <el-table-column
                prop="price"
                label="订单总价"
                width="100">
            </el-table-column>
            <el-table-column
                prop="status"
                label="订单状态"
                width="100">
            </el-table-column>
        </el-table>
    </div>
</template>

<script>
export default {
    name: "order",
    data(){
        return{
            ordersTable:[]
        }
    },
    mounted(){
        if(this.$cookies.get("order_second") != 'ok'){
            alert("无权限");
            this.$router.push("/adminindex")
        }else{
            this.$axios.get("/api/getAllOrders").then(res=>{
                this.ordersTable = res.data;
                console.log(this.ordersTable);
            });
        }
    }
}
</script>

<style scoped>

</style>